<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/inc/taglibs.jsp"%>
<script type="text/javascript">
function processBack(response){
	alertMsg.correct(response.message);
	$.pdialog.closeCurrent();
	navTab.reload("${path }/admin/userRechargeBalance?eqId=${id}", "");
}
</script>

<div class="pageContent">
	<form method="post" action="${path }/admin/userRechargeBalance/update" class="pageForm required-validate" onsubmit="return validateCallback(this, processBack);">
		<input name="id" type="hidden" size="75" value="${id}"/>
		<input name="oldBalance" type="hidden" size="75" value="${model.balance }"/>
		<div class="pageFormContent" layoutH="57" align="left">
			<p class="nowrap">
				<label>账号：</label>${userAccountInfo.accountName }
			</p>
			<p class="nowrap">
				<label>余额：</label>
				<input name="balance" type="text" onchange="f_check(this)" value="${model.balance }" class="required" />
			</p>
			<p class="nowrap">
				<label>调整理由：</label>
				<input name="updateReason" type="text"  value="" class="required" />
			</p>
		</div>
		<div class="formBar">
			<ul>
			<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">返回</button></div></div>
				</li>
			</ul>
		</div>
	</form>
	<script type="text/javascript">
		function f_check(obj){
           if(!checkAmountM(obj)){
               obj.value="0.00";
               obj.focus();
               return;
           }
		}
		
		function checkAmountM(obj){
			if(obj == null || obj.value == "")
				return true;
			var tar=obj.value;
			var re0=/^0*(\d+(\.\d{0,2})?)$/;
			var r = tar.match(re0);
			if(r==null){
				alert("只能输入2位小数的金额！");
				return false;
			}else{
				var point = tar.indexOf(".");
				if(point == -1){
					obj.value=tar+".00";
				}else if(1 == (tar.length-point)){
					obj.value=tar+"00";
				}else if(2 == (tar.length-point)){
					obj.value=tar+"0";
				}else if((tar.length-point)>3){
					obj.value = tar.substr(point+2);
				}
				return true;
			}
		}
	</script>
</div>
